package TeachLesson;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "deleteTeachLessonServlet")
public class deleteTeachLessonServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         String workerNo=request.getParameter("workerNo");
         String courseNo=request.getParameter("courseNo");
         TeachLessonsDao teachLessonsDao=new TeachLessonsDao();
         int row=teachLessonsDao.deleteTeachLesson(workerNo,courseNo);
         if(row>0){
             response.sendRedirect("techLessonServlet");
         }else {
             response.getWriter().println("删除出错");
         }
    }
}
